package com.music.controller;


import com.music.common.BaseResult;
import com.music.service.SmusicService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/smusic")
@Api(description = "音乐接口")
//@CrossOrigin
public class SmusicController {
        @Resource
        SmusicService smusicService;


    @RequestMapping(value = "/findAll",method = RequestMethod.GET)
    @ApiOperation("首页查询音乐")
    public BaseResult findAll(){
        return smusicService.findAll();
    }
    @RequestMapping(value = "/findAllSinger",method = RequestMethod.GET)
    @ApiOperation("首页查询歌手")
    public BaseResult findAllSinger(){
        return smusicService.findAllSinger();
    }
    @RequestMapping(value = "/findAllSingerForm",method = RequestMethod.POST)
    @ApiOperation("根据榜单查询音乐并更具音乐查询歌手")
    public BaseResult findAllSingerForm(@RequestBody Map map){
        return smusicService.findAllSingerForm((Integer) map.get("id"));
    }
    @RequestMapping(value = "/findAllForm",method = RequestMethod.GET)
    @ApiOperation("首页查询歌单")
    public BaseResult findAllForm(){
        return smusicService.findAllForm();
    }
    @RequestMapping(value = "/findOneSinger",method = RequestMethod.POST)
    @ApiOperation("根据歌手查询他所有的歌曲")
    public BaseResult findOneSinger(@RequestBody Map map){
        return smusicService.findOneSinger((Integer) map.get("id"));
    }
    @RequestMapping(value = "/findAllCmFormMusic",method = RequestMethod.POST)
    @ApiOperation("根据歌单查询歌曲和歌曲所对应的歌手")
    public BaseResult findAllCmFormMusic(@RequestBody Map map){
        return smusicService.findAllCmFormMusic((Integer) map.get("id"));
       /* return smusicService.findAllCmFormMusic(id);*/
    }

    @RequestMapping(value = "/findAllFormMusicSinger",method = RequestMethod.GET)
    @ApiOperation("首页查询歌单,歌手,歌曲")
    public BaseResult findAllFormMusicSinger(){
        return smusicService.findAllFormMusicSinger();
    }

}
